﻿using System;
using System.Collections.Generic;
using System.Web.Services;
using System.Collections;
using Mail1 = Model.WWW_User.Mail;
using Model;
using System.Web;

namespace WebServices.User
{
    [WebService(Namespace = "http://www.italki.com/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.Web.Script.Services.ScriptService]
    public class Mail : WebService
    {
        [WebMethod]
        public bool WriteLetter(string memberNo, string fromId, string title, string message) {
            return BLF.WWW_User.UserMail.Mail.WriteInform(memberNo, fromId, title, message);
        }

        /// <summary>
        /// 获得好友列表。
        /// </summary>
        [WebMethod]
        public ArrayList GetMemberFriends(string memberno, int pageIndex, int pageSize) {
            return BLF.WWW_WWW.Contact.Contacts.GetMemberFriends(memberno, pageIndex, pageSize);
        }

        #region snail
        [WebMethod]
        public int DelNotify(string memberno, string id)
        {
            return BLF.WWW_User.UserMail.Mail.DelNotify(memberno, id);
        }
        /// <summary>
        /// 回复消息(0：昵称、1：头像、2：时间)
        /// </summary>
        /// <param name="memberno">会员编号。</param>
        /// <param name="msgID">消息编号。</param>
        /// <param name="parentID">父ReplyID</param>
        /// <param name="body">回复内容。</param>
        /// <returns>(0：昵称、1：头像、2：时间)</returns>
        [WebMethod]
        public ArrayList ReplyMessage(string memberno, int msgID, string parentID, string body)
        {
            return BLF.WWW_User.UserMail.Mail.ReplyMessage(memberno, msgID, parentID, body);
        }

        [WebMethod]
        public int DeleteMessage(int pmid, string memberno)
        {
            return BLF.WWW_User.UserMail.Mail.DeleteMessage(pmid, memberno);
        }

        #endregion
        /// <summary>
        /// 更新消息已读状态
        /// </summary>
        [WebMethod]
        public CommonMessage UpdateIsRead(bool isRead, string pm_IDs)
        {
            string memberno = HttpContext.Current.User.Identity.Name;
            if (memberno == "")
            {
                return new CommonMessage();
            }
            return BLF.WWW_User.UserMail.Mail.UpdateIsRead(memberno, isRead, pm_IDs);
        }
    }
}